<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增临牌" bodyClass="white-bg"/>
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-temptag-add"  class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "销售员"/>：
            <i class="fa fa-question-circle-o" title="销售员"></i>
        </label>
        <div class="col-sm-8">
            <input name="saleUserid" class="form-control" type="text" value="${bpmCrmTemptag.saleUserid}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "销售订单编号"/>：
    </label>
        <div class="col-sm-8"><input name="saleOrderNumber"  class="form-control" type="text" value="${bpmCrmTemptag.saleOrderNumber}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "车辆识别号"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVin"  class="form-control" type="text" value="${bpmCrmTemptag.outCarVin}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "车型"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVehicle"  class="form-control" type="text" value="${bpmCrmTemptag.outCarVehicle}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "注册人姓名"/>：
    </label>
        <div class="col-sm-8"><input name="orderRegistrantName"  class="form-control" type="text" value="${bpmCrmTemptag.orderRegistrantName}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "注册人地址"/>：
    </label>
        <div class="col-sm-8"><input name="orderRegistrantAddress"  class="form-control" type="text" value="${bpmCrmTemptag.orderRegistrantAddress}" readonly="true">
        </div>
    </div>
    <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "注册人手机"/>：
    </label>
        <div class="col-sm-8"><input name="orderRegistrantPhone"  class="form-control" type="text" value="${bpmCrmTemptag.orderRegistrantPhone}" readonly="true">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "是否需要邮件"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="orderIsNeedMail" dictType="sys_crm_isOrNo" value="${bpmCrmTemptag.orderIsNeedMail}" readOnly="true"/>
        </div>
    </div>
    <div class="form-group isNeedMail">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "收件人是否同注册人"/>：</label>
        <div class="col-sm-8">
            <@form.radio name="orderRecipientisregistrant" dictType="sys_crm_isOrNo" value="${bpmCrmTemptag.orderRecipientisregistrant}" readOnly="true"/>
        </div>
    </div>
    <div class="form-group different">        <label class="col-sm-3 control-label"><@ctx.i18n text = "收件人姓名"/>：
    </label>
        <div class="col-sm-8"><input name="orderRecipientName"   class="form-control" type="text" value="${bpmCrmTemptag.orderRecipientName}" readonly="true">
        </div>
    </div>
    <div class="form-group different">        <label class="col-sm-3 control-label"><@ctx.i18n text = "收件人地址"/>：
    </label>
        <div class="col-sm-8"><input name="orderRecipientAddress"  class="form-control" type="text" value="${bpmCrmTemptag.orderRecipientAddress}" readonly="true">
        </div>
    </div>
    <div class="form-group different">        <label class="col-sm-3 control-label"><@ctx.i18n text = "收件人手机"/>：
    </label>
        <div class="col-sm-8"><input name="orderRecipientPhone"  class="form-control" type="text" value="${bpmCrmTemptag.orderRecipientPhone}" readonly="true">
        </div>
    </div>
    <div class="form-group different">
        <label class="col-sm-3 control-label"><@ctx.i18n text = "邮件备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="orderRecipientMailMemo" class="form-control" readonly="true">${bpmCrmTemptag.orderRecipientMailMemo}</textarea>
        </div>
    </div>

        <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "选择临时号牌"/>：
           </label>
            <div class="col-sm-8"><input name="selectTempTagNumber"  class="form-control" type="text" value="${bpmCrmTemptag.selectTempTagNumber}" readonly="true">
            </div>
         </div>
        <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "发货信息"/>：
           </label>
            <div class="col-sm-8"><input name="shippingInfo"  class="form-control" type="text" value="${bpmCrmTemptag.shippingInfo}" readonly="true">
            </div>
         </div>
        <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "运费"/>：
           </label>
            <div class="col-sm-8"><input name="shippingFee" class="form-control" type="text" value="${bpmCrmTemptag.shippingFee}" readonly="true">
            </div>
         </div>
        <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "临牌费"/>：
           </label>
            <div class="col-sm-8"><input name="tempTagFee"  class="form-control" type="text" value="${bpmCrmTemptag.tempTagFee}" readonly="true">
            </div>
         </div>
        <div class="form-group">        <label class="col-sm-3 control-label"><@ctx.i18n text = "总费用"/>：
           </label>
            <div class="col-sm-8"><input name="totalFee"  class="form-control" type="text" value="${bpmCrmTemptag.totalFee}" readonly="true">
            </div>
         </div>
</@form.form>
</div>
<@footer>
<script type="text/javascript">
    $(function () {
        if($("[name='orderIsNeedMail']")[0].checked){
            $(".isNeedMail").show();
            if($("[name='orderRecipientisregistrant']")[0].checked){
                $(".different").hide();
            }
            else{
                $(".different").show();
            }
        }
        else{
            $(".isNeedMail").hide();
            $(".different").hide();
        }
    })
    var prefix = baseURL + "bpm/temptag"
    $("#form-temptag-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        opt.warning("流程实例未启动，无法创建此申请单");
        return;
        var entryInfo = $('#form-temptag-add').serialize();
        console.log("替换之前的字符串为", entryInfo)
        var entryString = '';
        var newString = entryInfo.replace("orderIsNeedMail=Y", "orderIsNeedMail=1");
        newString = newString.replace("orderIsNeedMail=N", "orderIsNeedMail=0");
        newString = newString.replace("orderRecipientisregistrant=Y", "orderRecipientisregistrant=1");
        newString = newString.replace("orderRecipientisregistrant=N", "orderRecipientisregistrant=0");
        newString = newString + "&delFlag=0"
        newString = newString + "&processStatus=1"
        console.log("替换之后的字符串为", newString)
        if (opt.validate.form()) {
            opt.operate.save(prefix + "/add", newString);
        }
    }
    /**
     * redio 单选回调
     * @param id
     * @param data
     * @param event
     */
    function  redioCallback(id,data,event){
        if(id == "orderIsNeedMail"){
            if ($(data).is(':checked')){
                var menuType = $(event.target).val();
                if(menuType=="1"){
                    $(".isNeedMail").show();
                    if($("[name='orderRecipientisregistrant']")[0].checked){
                        $(".different").hide();
                    }
                    else{
                        $(".different").show();
                    }
                }
                else{
                    $(".different").hide();
                    $(".isNeedMail").hide();
                }
            }
        }
        else if(id=="orderRecipientisregistrant"){
            if ($(data).is(':checked')){
                var menuType = $(event.target).val();
                if(menuType=="1"){
                    $(".different").hide();
                }
                else{
                    $(".different").show();
                }
            }
        }
    }
</script>
</@footer>
</@pageTheme>